#define ElemType int

typedef struct ListNode List_Node;

#include "common.h"

int numIslands(char** grid, int gridSize, int* gridColSize);

void dfs(char** grid, int col, int row);

int main()
{
	return 0;
}

int col_len, row_len;
int numIslands(char** grid, int gridSize, int* gridColSize)
{
	col_len = gridSize, row_len = *gridColSize;
	int ans = 0;
	for (int i = 0; i < gridSize; i++)
		for (int j = 0; j < row_len; j++)
			if (grid[i][j] - '0') {
				ans++;
				dfs(grid, i, j);
			}
	return ans;
}

void dfs(char** grid, int col, int row)
{
	if (!(grid[col][row] - '0')) return;

	grid[col][row] = '0';

	if (col > 0) dfs(grid, col - 1, row);
	if (row > 0) dfs(grid, col, row - 1);
	if (col < col_len - 1) dfs(grid, col + 1, row);
	if (row < row_len - 1) dfs(grid, col, row + 1);
}